package com.connector.server.util;

import java.util.UUID;
import com.connector.base.connection.SessionContext;
import com.connector.base.message.model.HandshakeMessage;

public class SessionContextUtil
{
    public static SessionContext buildSessionContext(final HandshakeMessage message) {
        final SessionContext sessionContext = new SessionContext();
        sessionContext.setClientVersion(message.getClientVersion());
        sessionContext.setDeviceId(message.getDeviceId());
        sessionContext.setOsName(message.getOsName());
        sessionContext.setOsVersion(message.getOsVersion());
        sessionContext.setUserId(message.getUserId());
        sessionContext.setMobile(message.getMobile());
        sessionContext.setTime1(System.currentTimeMillis());
        sessionContext.setUuid(UUID.randomUUID().toString());
        sessionContext.setCid(message.getCid());
        sessionContext.setAppid(message.getAppid());
        return sessionContext;
    }
}
